/* 档案详情-基础设置api */
import { ajaxService } from '@/utils/request';
import {
  GetArchivesHeaderMessage,
  delSupplierServer,
  postSupplierServer,
  putSupplierServer,
  GetArchivesDetaliType,
  delSupplierAccount,
  postSupplierAccount,
  delSuppliergoods,
  putSuppliergoods,
  postSuppliergoods,
  DeleteSupplierContact,
  EditSupplierContact,
  PostSupplierContact,
} from './type';

const env = import.meta.env;
let baseURL = env.VITE_SUPPLOER_URL;

// 获取供应商档案详情头部数据
export function GetArchivesHeaderMessage(data: GetArchivesHeaderMessage) {
  return ajaxService({
    url: '/supplier/list/detail/header/message',
    method: 'get',
    params: data,
    baseURL,
  });
}

// 获取供应商详情信息
export function GetArchivesDetaliType(data: GetArchivesDetaliType) {
  return ajaxService({
    url: '/supplier/list/detail/type',
    method: 'get',
    params: data,
    baseURL,
  });
}

// 添加联系人
export function PostSupplierContact(data: PostSupplierContact) {
  return ajaxService({
    url: '/supplier/list/man/add',
    method: 'post',
    data,
    baseURL,
  });
}

// 编辑联系人
export function EditSupplierContact(data: EditSupplierContact) {
  return ajaxService({
    url: '/supplier/list/man/edit',
    method: 'put',
    data,
    baseURL,
  });
}

// 删除联系人
export function DeleteSupplierContact(params: DeleteSupplierContact) {
  return ajaxService({
    url: '/supplier/list/man/del',
    method: 'delete',
    params,
    baseURL,
  });
}

// 添加供应商产品
export function postSuppliergoods(data: postSuppliergoods) {
  return ajaxService({
    url: '/supplier/auth/product/add',
    method: 'post',
    data,
    baseURL,
  });
}

// 修改供应商产品
export function putSuppliergoods(data: putSuppliergoods) {
  return ajaxService({
    url: '/supplier/auth/product/edit',
    method: 'put',
    data,
    baseURL,
  });
}

// 删除供应商产品
export function delSuppliergoods(params: delSuppliergoods) {
  return ajaxService({
    url: '/supplier/auth/product/del',
    method: 'delete',
    params,
    baseURL,
  });
}

// 添加供应商产品
export function postSupplierAccount(data: postSupplierAccount) {
  return ajaxService({
    url: '/supplier/list/account/add',
    method: 'post',
    data,
    baseURL,
  });
}

// 删除供应商账户
export function delSupplierAccount(params: delSupplierAccount) {
  return ajaxService({
    url: '/supplier/list/account/del',
    method: 'delete',
    params,
    baseURL,
  });
}

// 添加供应商服务
export function postSupplierServer(data: postSupplierServer) {
  return ajaxService({
    url: '/supplier/list/server/add',
    method: 'post',
    data,
    baseURL,
  });
}

// 修改供应商服务
export function putSupplierServer(data: putSupplierServer) {
  return ajaxService({
    url: '/supplier/list/server/edit',
    method: 'put',
    data,
    baseURL,
  });
}

// 删除供应商服务
export function delSupplierServer(params: delSupplierServer) {
  return ajaxService({
    url: '/supplier/list/server/del',
    method: 'delete',
    params,
    baseURL,
  });
}
